# tests/Makefile

# 配置变量
KERNEL_DIR ?= /usr/src/linux-headers-$(shell uname -r)
RTAI_DIR ?= /usr/realtime
CC = gcc

EXTRA_CFLAGS := -I$(PWD)/../ -I$(RTAI_DIR)/include -I/lib/modules/$(shell uname -r)/build/include -I/lib/modules/$(shell uname -r)/build/arch/x86/include -std=gnu11
EXTRA_CFLAGS += -D__IN_RTAI__

obj-m := test_kernel.o
test_kernel-objs := test_kernel_module.o ../rtai_shmem.o

# 内核模块构建
all: 
	$(MAKE) -C $(KERNEL_DIR) M=$(PWD) EXTRA_CFLAGS="$(EXTRA_CFLAGS)" modules

clean:
	make -C $(KERNEL_DIR) M=$(PWD) clean

.PHONY: all clean
